package chainOfResponsibilityPattern;

// Handler具体实现类--B：处理500以下请求
public class ConcreteHandlerB extends Handler {
    public ConcreteHandlerB(Handler nextHandler) {
        super(nextHandler);
    }

    @Override
    void handleRequest(Double amount) {
        if (amount <= 500) {
            System.out.println("B审批通过，金额: " + amount);
        } else if (nextHandler != null) {
            System.out.println("B无法审批，转交给下一级");
            nextHandler.handleRequest(amount);
        } else {
            System.out.println("无人可以处理该请求");
        }
    }
}
